https = require 'https'
fs = require 'fs'

xmlStr = ''
fs.readFile './soap/demo.xml', (err, data)->
  if err
   throw err
  xmlStr = data.toString()
  # console.log xmlStr

console.log xmlStr

sconf =         
    host: 'api.baidu.com',
    method: 'POST',
    header: {
        # // 'Accept-Encoding': 'gzip,deflate',
        'Content-Type': 'text/xml;charset=UTF-8',
        'Content-Length': xmlStr.length
    },
    path: '/sem/sms/v2/ReportService?wsdl'


req = https.request sconf, (res)-> 
    # console.log(res)
    res.on 'data', (data)->
        # console.log data.toString()
        fs.appendFile './tmp.xml', data.toString()

    


req.end()